<template>
  <div class="footer">
    <div id="maints"></div>
  </div>
</template>
<script lang="ts" setup>
import echarts from "echarts";
import { onMounted } from "vue";

let option = {
  title: {
    text: "大洲感染人数饼状图",
    x: "center",
    textStyle: {
      color: "#fff",
    },
  },
  tooltip: {
    trigger: "item",
  },
  //   legend: {
  //     buttom: "5%",
  //     left: "center",
  //   },
  series: [
    {
      name: "Access From",
      type: "pie",
      radius: ["40%", "70%"],
      avoidLabelOverlap: false,
      itemStyle: {
        borderRadius: 10,
        borderColor: "#fff",
        borderWidth: 2,
      },
      label: {
        show: false,
        position: "center",
      },
      emphasis: {
        label: {
          show: true,
          fontSize: 40,
          fontWeight: "bold",
        },
      },
      labelLine: {
        show: false,
      },
      data: [
        { value:8, name: "Email" ,
         itemStyle: {
            normal: {
              color: {
                // 完成的圆环的颜色
                colorStops: [
                  {
                    offset: 0,
                    color: "#1089e7", // 0% 处的颜色
                  },
                  {
                    offset: 1,
                    color: "#1089e7", // 100% 处的颜色
                  },
                ],
              },
              label: {
                show: false,
              },
              labelLine: {
                show: false,
              },
            },
          },
        },
        {
          value:2,
          name: "Union Ads",
          itemStyle: {
            normal: {
              color: {
                // 完成的圆环的颜色
                colorStops: [
                  {
                    offset: 0,
                    color: "pink", // 0% 处的颜色
                  },
                  {
                    offset: 1,
                    color: "pink", // 100% 处的颜色
                  },
                ],
              },
              label: {
                show: false,
              },
              labelLine: {
                show: false,
              },
            },
          },
        },
      ],
    },
  ],
};
onMounted(() => {
  var chartDom = document.getElementById("maints");
  var myChart = echarts.init(chartDom);
  myChart.setOption(option);
  window.addEventListener(
    "resize",
    function () {
      myChart.resize();
    },
    false
  );
});
</script>
<style lang="scss" scoped>
.footer {
  color: #fff;
  width: 510px;
  height: 280px;
}
#maints {
  height: 335px;
  text-align: center;
  padding: 0 10px;
  margin-top: 10px;
}
</style>
